<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Top Customers with Callback</title>
</head>
<body>
    <div id="divCustomers">
    </div>
    <div id="images"></div>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    
    <script type="text/javascript">
        function onCustomerLoaded(result, methodName) {
        		console.log(result);
            var html = '<ul>';
//          for (var i = 0; i < result.length; i++) {
//              html += '<li>' + result[i] + '</li>';
//          }
			html+= '<li>'+result.ip+'</li>';
            html += '</ul>';
            document.getElementById('divCustomers').innerHTML = html;
        }
        
        //jquery jsonp请求
        $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",function(data){
				$.each(data.items,function(i,item){
					$("<img/>").attr("src", item.media.m).appendTo("#images");
    					if ( i == 3 ) return false;
				})
			})
    </script>
    <script type="text/javascript" src="https://c.y.qq.com/splcloud/fcgi-bin/p.fcg?g_tk=5381&format=jsonp&jsonpCallback=onCustomerLoaded"></script>
</body>
</html>

